<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员登录</title>
<link rel="stylesheet" type="text/css" href="__STATIC__/login/css/style.css" />
<link rel="stylesheet" type="text/css" href="__STATIC__/login/css/body.css"/>
</head>
<body>
<div class="container">
	<section id="content">
		<form action="">
			<h1>会员登录</h1>
			<div>
				<input type="text" placeholder="用户名" required="" name="nickname" id="nickname" />
			</div>
			<div>
				<input type="password" placeholder="密码" required="" name="password" id="password" />
			</div>
			 <div class="">
				<span class="help-block u-errormessage" id="js-server-helpinfo">&nbsp;</span>			</div> 
			<div>
				<!-- <input type="submit" value="Log in" /> -->
				<input type="button" value="登录" class="btn btn-primary" id="js-btn-login"/>
				<input type="button" value="注册" class="btn btn-primary" id="js-btn-register"/>
				<!--<a href="#">忘记密码?</a>-->
				<!-- <a href="#">Register</a> -->
			</div>
		</form><!-- form -->
		 <div class="button">
			<span class="help-block u-errormessage" id="js-server-helpinfo">&nbsp;</span>
		</div> <!-- button -->
	</section><!-- content -->
</div>
<!-- container -->


<br><br><br><br>
<div style="text-align:center;">

</div>
<script type="text/javascript" src="__STATIC__/register/js/jquery-1.8.2.min.js"></script>
<script>
    $(function() {
        $('#js-btn-login').click(function() {
            var d = {};
            var t = $('form').serializeArray();
            $.each(t, function() {
                d[this.name] = this.value;
            });
            var data = d;
            var url = '{:url("/user/login")}';
            $.post(url,data,function(data){
                if(data.code==1){
                    alert(data.msg);
                    window.location.href = "{:url('index/index')}"
                }else{
                    alert(data.msg);
                }
            },'json');
        });
        $('#js-btn-register').click(function() {
          window.location.href = '/user/register'
		})
    });
</script>
</body>
</html>